************************* INTERACTIONS - HYPOTHESIS 8a and 8b  **************************


*********************** TRUST IN THE MILITARY **********************
*** Figure 4 and B1

drop if q19_grupo==88
drop if q19_grupo==99

*multinomial logistic regression
mlogit q19_grupo i.sexo##i.q1_grupo i.sexo##i.q2_grupo_alt i.sexo##i.regiao i.sexo##i.q3_grupo i.q11_grupo i.q12 i.q10_grupo i.q39, baseoutcome(3)

*expected probabilities (gender x age)
margins sexo, at(q1_grupo=(1(1)4)) predict(pr outcome(1))
marginsplot, title("") subtitle("  " "Fully or a lot") xlabel(1 "1" 2 "2" 3 "3" 4 "4") ///
ytitle("Probability") ///
fxsize(100) ///
recast(scatter) recastci(rcap) plotopts(msize(medlarge) lwidth(medthick)) xtitle("") ///
graphregion(color(white)) bgcolor(white) ///
plotr(lcolor (black) m(large)) graphregion(m(tiny)) ///
plot ( , label("F" "M")) ///
name(trust_age1)

margins sexo, at(q1_grupo=(1(1)4)) predict(pr outcome(2))
marginsplot, title("") subtitle("  " "Reasonably") xlabel(1 "1" 2 "2" 3 "3" 4 "4") ///
ytitle("") yscale(off) ///
fxsize(87) ///
recast(scatter) recastci(rcap) plotopts(msize(medlarge) lwidth(medthick)) xtitle("") ///
graphregion(color(white)) bgcolor(white) ///
plotr(lcolor (black) m(large)) graphregion(m(tiny)) ///
plot ( , label("F" "M")) ///
name(trust_age2) 

margins sexo, at(q1_grupo=(1(1)4)) predict(pr outcome(3))
marginsplot, title("") subtitle("Little or does" "not trust") xlabel(1 "1" 2 "2" 3 "3" 4 "4") ///
ytitle("") yscale(off) ///
fxsize(87) ///
recast(scatter) recastci(rcap) plotopts(msize(medlarge) lwidth(medthick)) xtitle("") ///
graphregion(color(white)) bgcolor(white) ///
plotr(lcolor (black) m(large)) graphregion(m(tiny)) ///
plot ( , label("F" "M")) ///
name(trust_age3) 

******************** FIGURE 4a *******************
gr combine trust_age1 trust_age2 trust_age3, title("4a. Gender × Age", size(medium)) ///
graphregion(color(white)) col(3) ycommon name(trust_age_all) 

*expected probabilities (gender x race)
margins sexo, at(q3_grupo=(1(1)2)) predict(pr outcome(1))
marginsplot, title("") subtitle("  " "Fully or a lot") xlabel(1 "W" 2 "B/P") ///
ytitle("Probability") ///
fxsize(100) ///
recast(scatter) recastci(rcap) plotopts(msize(medlarge) lwidth(medthick)) xtitle("") ///
graphregion(color(white)) bgcolor(white) ///
plotr(lcolor (black) m(large)) graphregion(m(tiny)) ///
plot ( , label("F" "M")) ///
name(trust_race1)

margins sexo, at(q3_grupo=(1(1)2)) predict(pr outcome(2))
marginsplot, title("") subtitle("  " "Reasonably") xlabel(1 "W" 2 "B/P") ///
ytitle("") yscale(off) ///
fxsize(87) ///
recast(scatter) recastci(rcap) plotopts(msize(medlarge) lwidth(medthick)) xtitle("") ///
graphregion(color(white)) bgcolor(white) ///
plotr(lcolor (black) m(large)) graphregion(m(tiny)) ///
plot ( , label("F" "M")) ///
name(trust_race2) 

margins sexo, at(q3_grupo=(1(1)2)) predict(pr outcome(3))
marginsplot, title("") subtitle("Little or does" "does not trust") xlabel(1 "W" 2 "B/P") ///
ytitle("") yscale(off) ///
fxsize(87) ///
recast(scatter) recastci(rcap) plotopts(msize(medlarge) lwidth(medthick)) xtitle("") ///
graphregion(color(white)) bgcolor(white) ///
plotr(lcolor (black) m(large)) graphregion(m(tiny)) ///
plot ( , label("F" "M")) ///
name(trust_race3) 

******************** FIGURE 4b *******************
gr combine trust_race1 trust_race2 trust_race3, title("4b. Gender × Race", size(medium)) ///
graphregion(color(white)) col(3) ycommon name(trust_race_all) 

*expected probabilities (gender x education)
margins sexo, at(q2_grupo_alt=(2(1)4)) predict(pr outcome(1))
marginsplot, title("") subtitle("  " "Fully or a lot") xlabel(2 "1" 3 "2" 4 "3") ///
ytitle("Probability") ///
fxsize(100) ///
recast(scatter) recastci(rspike) plotopts(msize(medlarge) lwidth(medthick)) xtitle("") ///
graphregion(color(white)) bgcolor(white) ///
plotr(lcolor (black) m(large)) graphregion(m(tiny)) ///
plot ( , label("F" "M")) ///
name(trust_educ1)

margins sexo, at(q2_grupo_alt=(2(1)4)) predict(pr outcome(2))
marginsplot, title("") subtitle("  " "Reasonably") xlabel(2 "1" 3 "2" 4 "3") ///
ytitle("") yscale(off) ///
fxsize(87) ///
recast(scatter) recastci(rspike) plotopts(msize(medlarge) lwidth(medthick)) xtitle("") ///
graphregion(color(white)) bgcolor(white) ///
plotr(lcolor (black) m(large)) graphregion(m(tiny)) ///
plot ( , label("F" "M")) ///
name(trust_educ2) 

margins sexo, at(q2_grupo_alt=(2(1)4)) predict(pr outcome(3))
marginsplot, title("") subtitle("Little or does not trust") xlabel(2 "1" 3 "2" 4 "3") ///
ytitle("") yscale(off) ///
fxsize(87) ///
recast(scatter) recastci(rspike) plotopts(msize(medlarge) lwidth(medthick)) xtitle("") ///
graphregion(color(white)) bgcolor(white) ///
plotr(lcolor (black) m(large)) graphregion(m(tiny)) ///
plot ( , label("F" "M")) ///
name(trust_educ3) 

******************** FIGURE B1a *******************
gr combine trust_educ1 trust_educ2 trust_educ3, title("B1a. Gender × Education", size(medium)) ///
graphregion(color(white)) col(3) ycommon name(trust_educ_all) 

*expected probabilities (gender x region)
margins sexo, at(regiao=(1(1)5)) predict(pr outcome(1))
marginsplot, title("") subtitle("  " "Fully/a lot") xlabel(1 "N" 2 "NE" 3 "SE" 4 "S" 5 "CW") ///
ytitle("Probability") ///
fxsize(100) ///
recast(scatter) recastci(rcap) plotopts(msize(medlarge) lwidth(medthick)) xtitle("") ///
graphregion(color(white)) bgcolor(white) ///
plotr(lcolor (black) m(large)) graphregion(m(tiny)) ///
plot ( , label("F" "M")) ///
name(trust_region1)

margins sexo, at(regiao=(1(1)5)) predict(pr outcome(2))
marginsplot, title("") subtitle("  " "Moderately") xlabel(1 "N" 2 "NE" 3 "SE" 4 "S" 5 "CW") ///
ytitle("") yscale(off) ///
fxsize(87) ///
recast(scatter) recastci(rcap) plotopts(msize(medlarge) lwidth(medthick)) xtitle("") ///
graphregion(color(white)) bgcolor(white) ///
plotr(lcolor (black) m(large)) graphregion(m(tiny)) ///
plot ( , label("F" "M")) ///
name(trust_region2) 

margins sexo, at(regiao=(1(1)5)) predict(pr outcome(3))
marginsplot, title("") subtitle("Little or" "does not trust") xlabel(1 "N" 2 "NE" 3 "SE" 4 "S" 5 "CW") ///
ytitle("") yscale(off) ///
fxsize(87) ///
recast(scatter) recastci(rcap) plotopts(msize(medlarge) lwidth(medthick)) xtitle("") ///
graphregion(color(white)) bgcolor(white) ///
plotr(lcolor (black) m(large)) graphregion(m(tiny)) ///
plot ( , label("F" "M")) ///
name(trust_region3) 
 
******************** FIGURE B1b *******************
gr combine trust_region1 trust_region2 trust_region3, title("B1b. Gender × Region", size(medium)) ///
graphregion(color(white)) col(3) ycommon name(trust_region_all) 




************************* COLLABORATION IN CASE OF WAR **********************
*** Figure 5 and B2

drop if q21==88
drop if q21==99

mlogit q21 i.sexo##i.q1_grupo i.sexo##i.q2_grupo_alt i.sexo##i.regiao i.sexo##i.q3_grupo i.q10_grupo i.q11_grupo i.q12 i.q39, rrr baseoutcome(4)

*expected probabilities (gender x age)
margins sexo, at(q1_grupo=(1(1)4)) predict(pr outcome(1))
marginsplot, title("") subtitle("As a soldier," "in combats") xlabel(1 "1" 2 "2" 3 "3" 4 "4") ///
ytitle("Probability") ///
fxsize(100) ///
recast(scatter) recastci(rcap) plotopts(msize(medlarge) lwidth(medthick)) xtitle("") ///
graphregion(color(white)) bgcolor(white) ///
plotr(lcolor (black) m(large)) graphregion(m(tiny)) ///
plot ( , label("F" "M")) ///
name(partic_age1)

margins sexo, at(q1_grupo=(1(1)4)) predict(pr outcome(2))
marginsplot, title("") subtitle("As a soldier," "not in combats") xlabel(1 "1" 2 "2" 3 "3" 4 "4") ///
ytitle("") yscale(off) ///
fxsize(87) ///
recast(scatter) recastci(rcap) plotopts(msize(medlarge) lwidth(medthick)) xtitle("") ///
graphregion(color(white)) bgcolor(white) ///
plotr(lcolor (black) m(large)) graphregion(m(tiny)) ///
plot ( , label("F" "M")) ///
name(partic_age2) 

margins sexo, at(q1_grupo=(1(1)4)) predict(pr outcome(3))
marginsplot, title("") subtitle("  " "As a civilian") xlabel(1 "1" 2 "2" 3 "3" 4 "4") ///
ytitle("") yscale(off) ///
fxsize(87) ///
recast(scatter) recastci(rcap) plotopts(msize(medlarge) lwidth(medthick)) xtitle("") ///
graphregion(color(white)) bgcolor(white) ///
plotr(lcolor (black) m(large)) graphregion(m(tiny)) ///
plot ( , label("F" "M")) ///
name(partic_age3) 

margins sexo, at(q1_grupo=(1(1)4)) predict(pr outcome(4))
marginsplot, title("") subtitle("  " "No") xlabel(1 "1" 2 "2" 3 "3" 4 "4") ///
ytitle("") yscale(off) ///
fxsize(87) ///
recast(scatter) recastci(rcap) plotopts(msize(medlarge) lwidth(medthick)) xtitle("") ///
graphregion(color(white)) bgcolor(white) ///
plotr(lcolor (black) m(large)) graphregion(m(tiny)) ///
plot ( , label("F" "M")) ///
name(partic_age4) 
 
******************** FIGURE 5a *******************
gr combine partic_age1 partic_age2 partic_age3 partic_age4, title("5a. Gender × Age", size(medium)) graphregion(color(white)) col(4) ycommon name(partic_age_all) 

*expected probabilities (gender x race)
margins sexo, at(q3_grupo=(1(1)2)) predict(pr outcome(1))
marginsplot, title("") subtitle("As a soldier," "in combats") xlabel(1 "W" 2 "B/P") ///
ytitle("Probability") ///
fxsize(100) ///
recast(scatter) recastci(rcap) plotopts(msize(medlarge) lwidth(medthick)) xtitle("") ///
graphregion(color(white)) bgcolor(white) ///
plotr(lcolor (black) m(large)) graphregion(m(tiny)) ///
plot ( , label("F" "M")) ///
name(partic_race1)

margins sexo, at(q3_grupo=(1(1)2)) predict(pr outcome(2))
marginsplot, title("") subtitle("As a soldier," "not in combats") xlabel(1 "W" 2 "B/P") ///
ytitle("") yscale(off) ///
fxsize(87) ///
recast(scatter) recastci(rcap) plotopts(msize(medlarge) lwidth(medthick)) xtitle("") ///
graphregion(color(white)) bgcolor(white) ///
plotr(lcolor (black) m(large)) graphregion(m(tiny)) ///
plot ( , label("F" "M")) ///
name(partic_race2) 

margins sexo, at(q3_grupo=(1(1)2)) predict(pr outcome(3))
marginsplot, title("") subtitle("  " "As a civilian") xlabel(1 "W" 2 "B/P") ///
ytitle("") yscale(off) ///
fxsize(87) ///
recast(scatter) recastci(rcap) plotopts(msize(medlarge) lwidth(medthick)) xtitle("") ///
graphregion(color(white)) bgcolor(white) ///
plotr(lcolor (black) m(large)) graphregion(m(tiny)) ///
plot ( , label("F" "M")) ///
name(partic_race3) 

margins sexo, at(q3_grupo=(1(1)2)) predict(pr outcome(4))
marginsplot, title("") subtitle("  " "No") xlabel(1 "W" 2 "B/P") ///
ytitle("") yscale(off) ///
fxsize(87) ///
recast(scatter) recastci(rspike) plotopts(msize(medlarge) lwidth(medthick)) xtitle("") ///
graphregion(color(white)) bgcolor(white) ///
plotr(lcolor (black) m(large)) graphregion(m(tiny)) ///
plot ( , label("F" "M")) ///
name(partic_race4) 

******************** FIGURE 5b *******************
gr combine partic_race1 partic_race2 partic_race3 partic_race4, title("5b. Gender × Race", size(medium)) ///
graphregion(color(white)) col(4) ycommon name(partic_race_all) 

*expected probabilities (gender x education)
margins sexo, at(q2_grupo=(2(1)4)) predict(pr outcome(1))
marginsplot, title("") subtitle("As a soldier," "in combats") xlabel(2 "1" 3 "2" 4 "3") ///
ytitle("Probability") ///
fxsize(100) ///
recast(scatter) recastci(rcap) plotopts(msize(medlarge) lwidth(medthick)) xtitle("") ///
graphregion(color(white)) bgcolor(white) ///
plotr(lcolor (black) m(large)) graphregion(m(tiny)) ///
plot ( , label("F" "M")) ///
name(partic_educ1)

margins sexo, at(q2_grupo=(2(1)4)) predict(pr outcome(2))
marginsplot, title("") subtitle("As a soldier," "not in combats") xlabel(2 "1" 3 "2" 4 "3") ///
ytitle("") yscale(off) ///
fxsize(87) ///
recast(scatter) recastci(rcap) plotopts(msize(medlarge) lwidth(medthick)) xtitle("") ///
graphregion(color(white)) bgcolor(white) ///
plotr(lcolor (black) m(large)) graphregion(m(tiny)) ///
plot ( , label("F" "M")) ///
name(partic_educ2) 

margins sexo, at(q2_grupo=(2(1)4)) predict(pr outcome(3))
marginsplot, title("") subtitle("  " "As a civilian") xlabel(2 "1" 3 "2" 4 "3") ///
ytitle("") yscale(off) ///
fxsize(87) ///
recast(scatter) recastci(rcap) plotopts(msize(medlarge) lwidth(medthick)) xtitle("") ///
graphregion(color(white)) bgcolor(white) ///
plotr(lcolor (black) m(large)) graphregion(m(tiny)) ///
plot ( , label("F" "M")) ///
name(partic_educ3) 

margins sexo, at(q2_grupo=(2(1)4)) predict(pr outcome(4))
marginsplot, title("") subtitle("  " "No") xlabel(2 "1" 3 "2" 4 "3") ///
ytitle("") yscale(off) ///
fxsize(87) ///
recast(scatter) recastci(rcap) plotopts(msize(medlarge) lwidth(medthick)) xtitle("") ///
graphregion(color(white)) bgcolor(white) ///
plotr(lcolor (black) m(large)) graphregion(m(tiny)) ///
plot ( , label("F" "M")) ///
name(partic_educ4) 

******************** FIGURE B2a *******************
gr combine partic_educ1 partic_educ2 partic_educ3 partic_educ4, title("B2a. Gender × Education", size(medium)) ///
graphregion(color(white)) col(4) ycommon name(partic_educ_all) 

*expected probabilities (gender x region)
margins sexo, at(regiao=(1(1)5)) predict(pr outcome(1))
marginsplot, title("") subtitle("As a soldier," "in combats") xlabel(1 "N" 2 "NE" 3 "SE" 4 "S" 5 "CW") ///
ytitle("Probability") ///
fxsize(100) ///
recast(scatter) recastci(rcap) plotopts(msize(medlarge) lwidth(medthick)) xtitle("") ///
graphregion(color(white)) bgcolor(white) ///
plotr(lcolor (black) m(large)) graphregion(m(tiny)) ///
plot ( , label("F" "M")) ///
name(partic_region1)

margins sexo, at(regiao=(1(1)5)) predict(pr outcome(2))
marginsplot, title("") subtitle("As a soldier," "not in combats") xlabel(1 "N" 2 "NE" 3 "SE" 4 "S" 5 "CW") ///
ytitle("") yscale(off) ///
fxsize(87) ///
recast(scatter) recastci(rcap) plotopts(msize(medlarge) lwidth(medthick)) xtitle("") ///
graphregion(color(white)) bgcolor(white) ///
plotr(lcolor (black) m(large)) graphregion(m(tiny)) ///
plot ( , label("F" "M")) ///
name(partic_region2) 

margins sexo, at(regiao=(1(1)5)) predict(pr outcome(3))
marginsplot, title("") subtitle("  " "As a civilian") xlabel(1 "N" 2 "NE" 3 "SE" 4 "S" 5 "CW") ///
ytitle("") yscale(off) ///
fxsize(87) ///
recast(scatter) recastci(rcap) plotopts(msize(medlarge) lwidth(medthick)) xtitle("") ///
graphregion(color(white)) bgcolor(white) ///
plotr(lcolor (black) m(large)) graphregion(m(tiny)) ///
plot ( , label("F" "M")) ///
name(partic_region3) 

margins sexo, at(regiao=(1(1)5)) predict(pr outcome(4))
marginsplot, title("") subtitle("  " "No") xlabel(1 "N" 2 "NE" 3 "SE" 4 "S" 5 "CW") ///
ytitle("") yscale(off) ///
fxsize(87) ///
recast(scatter) recastci(rcap) plotopts(msize(medlarge) lwidth(medthick)) xtitle("") ///
graphregion(color(white)) bgcolor(white) ///
plotr(lcolor (black) m(large)) graphregion(m(tiny)) ///
plot ( , label("F" "M")) ///
name(partic_region4) 

******************** FIGURE B2b *******************
gr combine partic_region1 partic_region2 partic_region3 partic_region4, title("B2b. Gender × Region", size(medium)) ///
graphregion(color(white)) col(4) ycommon name(partic_region_all) 




************************* LGBTQ IN THE MILITARY **********************
*** Figure 6 and B3

drop if q37==88
drop if q37==99

mlogit q37 i.sexo##i.q1_grupo i.sexo##i.q2_grupo_alt i.sexo##i.regiao i.sexo##i.q3_grupo i.q10_grupo i.q11_grupo i.q12 i.q39, rrr baseoutcome(2)

*expected probabilities (gender x age)
margins sexo, at(q1_grupo=(1(1)4)) predict(pr outcome(1))
marginsplot, title("") subtitle("Yes") xlabel(1 "1" 2 "2" 3 "3" 4 "4") ///
ytitle("Probability") ///
fxsize(100) ///
recast(scatter) recastci(rspike) plotopts(msize(medlarge) lwidth(medthick)) xtitle("") ///
graphregion(color(white)) bgcolor(white) ///
plotr(lcolor (black) m(large)) graphregion(m(tiny)) ///
plot ( , label("F" "M")) ///
name(homo_age1)

margins sexo, at(q1_grupo=(1(1)4)) predict(pr outcome(2))
marginsplot, title("") subtitle("No") xlabel(1 "1" 2 "2" 3 "3" 4 "4") ///
ytitle("") yscale(off) ///
fxsize(87) ///
recast(scatter) recastci(rspike) plotopts(msize(medlarge) lwidth(medthick)) xtitle("") ///
graphregion(color(white)) bgcolor(white) ///
plotr(lcolor (black) m(large)) graphregion(m(tiny)) ///
plot ( , label("F" "M")) ///
name(homo_age2) 

******************** FIGURE 6a *******************
gr combine homo_age1 homo_age2, title("6a. Gender × Age", size(medium)) ///
graphregion(color(white)) col(3) ycommon name(homo_age_all) 

*expected probabilities (gender x race)
margins sexo, at(q3_grupo=(1(1)2)) predict(pr outcome(1))
marginsplot, title("") subtitle("Yes") xlabel(1 "W" 2 "B and MR") ///
ytitle("Probability") ///
fxsize(100) ///
recast(scatter) recastci(rspike) plotopts(msize(medlarge) lwidth(medthick)) xtitle("") ///
graphregion(color(white)) bgcolor(white) ///
plotr(lcolor (black) m(large)) graphregion(m(tiny)) ///
plot ( , label("F" "M")) ///
name(homo_race1)

margins sexo, at(q3_grupo=(1(1)2)) predict(pr outcome(2))
marginsplot, title("") subtitle("No") xlabel(1 "W" 2 "B and MR") ///
ytitle("") yscale(off) ///
fxsize(87) ///
recast(scatter) recastci(rspike) plotopts(msize(medlarge) lwidth(medthick)) xtitle("") ///
graphregion(color(white)) bgcolor(white) ///
plotr(lcolor (black) m(large)) graphregion(m(tiny)) ///
plot ( , label("F" "M")) ///
name(homo_race2) 

******************** FIGURE 6b *******************
gr combine homo_race1 homo_race2, title("Gender × Race", size(medium)) ///
graphregion(color(white)) col(3) ycommon name(homo_race_all) 

*expected probabilities (gender x education)
margins sexo, at(q2_grupo_alt=(2(1)4)) predict(pr outcome(1))
marginsplot, title("") subtitle("Yes") xlabel(2 "1" 3 "2" 4 "3") ///
ytitle("Probability") ///
fxsize(100) ///
recast(scatter) recastci(rspike) plotopts(msize(medlarge) lwidth(medthick)) xtitle("") ///
graphregion(color(white)) bgcolor(white) ///
plotr(lcolor (black) m(large)) graphregion(m(tiny)) ///
plot ( , label("F" "M")) ///
name(homo_educ1)

margins sexo, at(q2_grupo_alt=(2(1)4)) predict(pr outcome(2))
marginsplot, title("") subtitle("No") xlabel(2 "1" 3 "2" 4 "3") ///
ytitle("") yscale(off) ///
fxsize(87) ///
recast(scatter) recastci(rspike) plotopts(msize(medlarge) lwidth(medthick)) xtitle("") ///
graphregion(color(white)) bgcolor(white) ///
plotr(lcolor (black) m(large)) graphregion(m(tiny)) ///
plot ( , label("F" "M")) ///
name(homo_educ2) 

******************** FIGURE B3a *******************
gr combine homo_educ1 homo_educ2, title("B3a. Gender × Education", size(medium)) ///
graphregion(color(white)) col(3) ycommon name(homo_educ_all) 

*expected probabilities (gender x region)
margins sexo, at(regiao=(1(1)5)) predict(pr outcome(1))
marginsplot, title("") subtitle("Yes") xlabel(1 "N" 2 "NE" 3 "SE" 4 "S" 5 "CW") ///
ytitle("Probability") ///
fxsize(100) ///
recast(scatter) recastci(rspike) plotopts(msize(medlarge) lwidth(medthick)) xtitle("") ///
graphregion(color(white)) bgcolor(white) ///
plotr(lcolor (black) m(large)) graphregion(m(tiny)) ///
plot ( , label("F" "M")) ///
name(homo_region1)

margins sexo, at(regiao=(1(1)5)) predict(pr outcome(2))
marginsplot, title("") subtitle("No") xlabel(1 "N" 2 "NE" 3 "SE" 4 "S" 5 "CW") ///
ytitle("") yscale(off) ///
fxsize(87) ///
recast(scatter) recastci(rspike) plotopts(msize(medlarge) lwidth(medthick)) xtitle("") ///
graphregion(color(white)) bgcolor(white) ///
plotr(lcolor (black) m(large)) graphregion(m(tiny)) ///
plot ( , label("F" "M")) ///
name(homo_region2) 

******************** FIGURE B3b *******************
gr combine homo_region1 homo_region2, title("B3b. Gender × Region", size(medium)) ///
graphregion(color(white)) col(3) ycommon name(homo_region_all) 




********************** THREATS OVER THE AMAZON **********************
*** Figure 7 and B4

drop if q23==88
drop if q23==99

mlogit q23_grupo i.sexo##i.q1_grupo i.sexo##i.q2_grupo_alt i.sexo##i.regiao i.sexo##i.q3_grupo i.q10_grupo i.q11_grupo i.q12 i.q39, rrr baseoutcome(3)

*expected probabilities (gender x age)
margins sexo, at(q1_grupo=(1(1)4)) predict(pr outcome(1))
marginsplot, title("") subtitle("  " "Fully or a lot") xlabel(1 "1" 2 "2" 3 "3" 4 "4") ///
ytitle("Probability") ///
fxsize(100) ///
recast(scatter) recastci(rcap) plotopts(msize(medlarge) lwidth(medthick)) xtitle("") ///
graphregion(color(white)) bgcolor(white) ///
plotr(lcolor (black) m(large)) graphregion(m(tiny)) ///
plot ( , label("F" "M")) ///
name(amazon_age1)

margins sexo, at(q1_grupo=(1(1)4)) predict(pr outcome(2))
marginsplot, title("") subtitle("  " "Reasonably") xlabel(1 "1" 2 "2" 3 "3" 4 "4") ///
ytitle("") yscale(off) ///
fxsize(87) ///
recast(scatter) recastci(rcap) plotopts(msize(medlarge) lwidth(medthick)) xtitle("") ///
graphregion(color(white)) bgcolor(white) ///
plotr(lcolor (black) m(large)) graphregion(m(tiny)) ///
plot ( , label("F" "M")) ///
name(amazon_age2) 

margins sexo, at(q1_grupo=(1(1)4)) predict(pr outcome(3))
marginsplot, title("") subtitle("A little or" "does not believe") xlabel(1 "1" 2 "2" 3 "3" 4 "4") ///
ytitle("") yscale(off) ///
fxsize(87) ///
recast(scatter) recastci(rcap) plotopts(msize(medlarge) lwidth(medthick)) xtitle("") ///
graphregion(color(white)) bgcolor(white) ///
plotr(lcolor (black) m(large)) graphregion(m(tiny)) ///
plot ( , label("F" "M")) ///
name(amazon_age3) 

******************** FIGURE 7a *******************
gr combine amazon_age1 amazon_age2 amazon_age3, title("7a. Gender × Age", size(medium)) ///
graphregion(color(white)) col(3) ycommon name(amazon_age_all) 

*expected probabilities (gender x race)
margins sexo, at(q3_grupo=(1(1)2)) predict(pr outcome(1))
marginsplot, title("") subtitle("  " "Fully or a lot") xlabel(1 "W" 2 "B/P") ///
ytitle("Probability") ///
fxsize(100) ///
recast(scatter) recastci(rcap) plotopts(msize(medlarge) lwidth(medthick)) xtitle("") ///
graphregion(color(white)) bgcolor(white) ///
plotr(lcolor (black) m(large)) graphregion(m(tiny)) ///
plot ( , label("F" "M")) ///
name(amazon_race1)

margins sexo, at(q3_grupo=(1(1)2)) predict(pr outcome(2))
marginsplot, title("") subtitle("  " "Reasonably") xlabel(1 "W" 2 "B/P") ///
ytitle("") yscale(off) ///
fxsize(87) ///
recast(scatter) recastci(rcap) plotopts(msize(medlarge) lwidth(medthick)) xtitle("") ///
graphregion(color(white)) bgcolor(white) ///
plotr(lcolor (black) m(large)) graphregion(m(tiny)) ///
plot ( , label("F" "M")) ///
name(amazon_race2) 

margins sexo, at(q3_grupo=(1(1)2)) predict(pr outcome(3))
marginsplot, title("") subtitle("A little or" "does not believe") xlabel(1 "W" 2 "B/P") ///
ytitle("") yscale(off) ///
fxsize(87) ///
recast(scatter) recastci(rcap) plotopts(msize(medlarge) lwidth(medthick)) xtitle("") ///
graphregion(color(white)) bgcolor(white) ///
plotr(lcolor (black) m(large)) graphregion(m(tiny)) ///
plot ( , label("F" "M")) ///
name(amazon_race3) 

******************** FIGURE 7b ******************* 
gr combine amazon_race1 amazon_race2 amazon_race3, title("7b. Gender × Race", size(medium)) ///
graphregion(color(white)) col(3) ycommon name(amazon_race_all)  
 
*expected probabilities (gender x education)
margins sexo, at(q2_grupo=(2(1)4)) predict(pr outcome(1))
marginsplot, title("") subtitle("  " "Fully or a lot") xlabel(2 "1" 3 "2" 4 "3") ///
ytitle("Probability") ///
fxsize(100) ///
recast(scatter) recastci(rcap) plotopts(msize(medlarge) lwidth(medthick)) xtitle("") ///
graphregion(color(white)) bgcolor(white) ///
plotr(lcolor (black) m(large)) graphregion(m(tiny)) ///
plot ( , label("F" "M")) ///
name(amazon_educ1)

margins sexo, at(q2_grupo=(2(1)4)) predict(pr outcome(2))
marginsplot, title("") subtitle("  " "Reasonably") xlabel(2 "1" 3 "2" 4 "3") ///
ytitle("") yscale(off) ///
fxsize(87) ///
recast(scatter) recastci(rcap) plotopts(msize(medlarge) lwidth(medthick)) xtitle("") ///
graphregion(color(white)) bgcolor(white) ///
plotr(lcolor (black) m(large)) graphregion(m(tiny)) ///
plot ( , label("F" "M")) ///
name(amazon_educ2) 

margins sexo, at(q2_grupo=(2(1)4)) predict(pr outcome(3))
marginsplot, title("") subtitle("A little or" "does not believe") xlabel(2 "1" 3 "2" 4 "3") ///
ytitle("") yscale(off) ///
fxsize(87) ///
recast(scatter) recastci(rcap) plotopts(msize(medlarge) lwidth(medthick)) xtitle("") ///
graphregion(color(white)) bgcolor(white) ///
plotr(lcolor (black) m(large)) graphregion(m(tiny)) ///
plot ( , label("F" "M")) ///
name(amazon_educ3) 

******************** FIGURE B4a *******************
gr combine amazon_educ1 amazon_educ2 amazon_educ3, title("B4a. Gender × Education", size(medium)) ///
graphregion(color(white)) col(3) ycommon name(amazon_educ_all) 

*expected probabilities (gender x race)
margins sexo, at(regiao=(1(1)5)) predict(pr outcome(1))
marginsplot, title("") subtitle("  " "Fully or a lot") xlabel(1 "N" 2 "NE" 3 "SE" 4 "S" 5 "CW") ///
ytitle("Probability") ///
fxsize(100) ///
recast(scatter) recastci(rcap) plotopts(msize(medlarge) lwidth(medthick)) xtitle("") ///
graphregion(color(white)) bgcolor(white) ///
plotr(lcolor (black) m(large)) graphregion(m(tiny)) ///
plot ( , label("F" "M")) ///
name(amazon_region1)

margins sexo, at(regiao=(1(1)5)) predict(pr outcome(2))
marginsplot, title("") subtitle("  " "Reasonably") xlabel(1 "N" 2 "NE" 3 "SE" 4 "S" 5 "CW") ///
ytitle("") yscale(off) ///
fxsize(87) ///
recast(scatter) recastci(rcap) plotopts(msize(medlarge) lwidth(medthick)) xtitle("") ///
graphregion(color(white)) bgcolor(white) ///
plotr(lcolor (black) m(large)) graphregion(m(tiny)) ///
plot ( , label("F" "M")) ///
name(amazon_region2) 

margins sexo, at(regiao=(1(1)5)) predict(pr outcome(3))
marginsplot, title("") subtitle("A little or" "does not believe") xlabel(1 "N" 2 "NE" 3 "SE" 4 "S" 5 "CW") ///
ytitle("") yscale(off) ///
fxsize(87) ///
recast(scatter) recastci(rcap) plotopts(msize(medlarge) lwidth(medthick)) xtitle("") ///
graphregion(color(white)) bgcolor(white) ///
plotr(lcolor (black) m(large)) graphregion(m(tiny)) ///
plot ( , label("F" "M")) ///
name(amazon_region3) 

******************** FIGURE B4b *******************
gr combine amazon_region1 amazon_region2 amazon_region3, title("B4b. Gender × Region", size(medium)) ///
graphregion(color(white)) col(3) ycommon name(amazon_region_all) 